﻿Income = function (dataUrl) {
    $(document).ready(function () {
        var pageIndex = 0;
        var pageSize = 10;
        $("#list").jqGrid({
            url: dataUrl,
            datatype: "json",
            mtype: "GET",
            colNames: ["Full Name", "Wage", "Meal Ticket", "Bonus", "Date", ""],
            colModel: [
                { name: "FullName", width: "100%" },
                { name: "Wage", width: 70 },
                { name: "MealTicket", width: 70 },
                { name: "Bonus", width: 70 },
                { name: "Date", width: 70 },
                { name: "Edit", formatter: formatLink, width: 50 }
            ],
            pager: "#pager",
            rowNum: 10,
            viewrecords: true,
            height: "100%",
            width: 1000,
            rownumbers: true,
            toppager: true,
            loadtext: "Loading data",
            caption: "Income data"
        });
    });
};

function formatLink(cellValue, options, rowObject) {
    var link = "<a href='" + cellValue + "' title='Edit'><i class='glyphicon glyphicon-pencil' />" + "</a>";
    return link;
}